<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>wifi config</title>
    <link rel="stylesheet" href="../style/common.css" />
    <link rel="stylesheet" href="../style/index.css" />
  </head>
  <body>
    <div class="app">
      <div class="navigation disable-select">
        <nav></nav>
      </div>
      <div class="container">
        <ul>
          <li>
            <div class="form-con">
              <label for="ssid">SSID：</label>
              <input
                class="contorl"
                type="text"
                id="ssid"
                placeholder="JD_AC_US_XXX"
              />
            </div>
          </li>
          <li>
            <div class="form-con">
              <label for="password">PASSWORD</label>
              <input
                class="contorl"
                type="text"
                id="password"
                placeholder="XXXXXX"
              />
            </div>
          </li>
          <li>
            <div class="form-con">
              <button id="confirm">确认按钮</button>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </body>
  <script>
    // 加载菜单栏
    const lists = [
      {
        name: "系统运行信息",
        href: "http://127.0.0.1:5501/index.html",
      },
      { name: "功能配置", href: "http://127.0.0.1:5501/views/fun-config.html" },
      {
        name: "WIFI配置",
        href: "http://127.0.0.1:5501/views/wifi-config.html",
        active: true,
      },
      {
        name: "WALLBOX控制",
        href: "http://127.0.0.1:5501/views/wall-box.html",
      },
      { name: "OTA", href: "http://127.0.0.1:5501/views/ota.html" },
    ];
    lists.forEach((item) => {
      const a = document.createElement("a");
      a.target = "_self";
      a.href = item.href;
      a.innerText = item.name;
      if (item.active) {
        a.classList.add("active");
      }
      document.querySelector("nav").appendChild(a);
    });
    // 加载菜单栏

    const btn = document.getElementById("confirm");
    btn.addEventListener("click", (e) => {
      e.preventDefault();
      const ssid = document.getElementById("ssid").value;
      const password = document.getElementById("password").value;
      console.log(ssid, password);
    });
  </script>
</html>
